import Vue from 'vue';
import Vuex from 'vuex';
Vue.use(Vuex);
//初始化数据
const state = {
	cartCount: 0,
	nickName: ''
};
const mutations = {
	updateUserInfo(state, nickName) {
		state.nickName = nickName
	},
	updateCartCount(state, cartCount) {
		state.cartCount += cartCount
	},
	initCartCount(state, cartCount) {
		state.cartCount = cartCount
	}
};
var store = new Vuex.Store({
	state,
	mutations
});
// 使用 export default 封装，让外部可以访问
export default store;